#ifndef MYSEARCH_H_INCLUDED
#define MYSEARCH_H_INCLUDED

#include <iostream>
#include <string>

using namespace std;

class SSTable{ 
private:
    int length;
    int* origin;

public:
    SSTable();
    SSTable(int, int*);
    ~SSTable();
    int getLength();
    int* getOrigin();
    void setLength(int);
    void setOrigin(int*);
    int binSearch(int); 
};

class BSTreeNode{ 
private:
    int data; 
    

public:
    BSTreeNode* lchild; 
    BSTreeNode* rchild; 
    BSTreeNode();
    BSTreeNode(int);
    BSTreeNode(int, BSTreeNode*, BSTreeNode*);
    ~BSTreeNode();
    int getData();
    BSTreeNode* getLChild();
    BSTreeNode* getRChild();
    void setData(int);
    void setLChild(BSTreeNode*);
    void setRChild(BSTreeNode*);

};

class BSTree{
private:
    int num; 
    BSTreeNode* root; 

public:
    BSTree();
    BSTree(int, int*); 
    ~BSTree();
    int getNum();
    BSTreeNode* getRoot();
    void setRoot(BSTreeNode*);
    void setNum(int);
    string printTree(); 
    bool searchNode(int); 
    bool addNode(int); 
    bool deleteNode(int); 
    bool addNodeHelper(BSTreeNode* node, int val);
    void printTemp(BSTreeNode* node, string& result);
    bool searchNodeHelper(BSTreeNode* node, int val);
    bool deleteNodeHelper(BSTreeNode** node, int val);
    BSTreeNode* findMin(BSTreeNode* node);
};

#endif // MYSEARCH_H_INCLUDED